// 使用Mock
var Mock = require('mockjs');

const Random = Mock.Random;

function getcarousePicList() {
  let carousePicArr = [];
  for(var i =0;i<40;i++) {
    let carousePicData = {
      imgUrl:Random.dataImage('375x375'),
      id:(i+1),
    }
    carousePicArr.push(carousePicData)
  }
  return carousePicArr;
}

function getOptData1() {
  let optArr1 = [];
  for(var i = 0;i<2;i++) {
    let optData = {
      optname:Random.cword(3)
    }
    optArr1.push(optData)
  }
  return optArr1;
}

function getOptData2() {
  let optArr2 = [];
  for(var i = 0;i<2;i++) {
    let optData = {
      optname:Random.cword(3)
    }
    optArr2.push(optData)
  }
  return optArr2;
}

function getCommentData() {
  let commentArr = [];
  for(var i = 0;i<50;i++) {
    let commentData = {
      headImg:Random.dataImage('56x56'),
      username:Random.cword(1)+'*****',
      commentContent:Random.cword(3)+','+Random.cword(6)+','+Random.cword(5)+','+Random.cword(8)+','+Random.cword(10),
      commentImg:Random.dataImage('144x144'),
    }
    commentArr.push(commentData);
  }
  return commentArr;
}

function bannerList() {
    let picList = [];
    for(let i = 0;i < 4;i++){
        let bannerPic = {
            img: Random.dataImage('343x192')
        };
        picList.push(bannerPic);
    }
    return picList;
}

function topList() {
    let topPic = [];
    for(let i = 0;i < 4;i++){
        let topData = {
            img: Random.dataImage('44x44'),
            text: Random.cword(4)
        };
        topPic.push(topData);
    }
    return topPic;
}
function exclusiveTitle() {
    let exclusiveList = [];
    for(let i = 0;i < 4;i++){
        let exclusiveData = {
            img: Random.dataImage('106x70')
        };
        exclusiveList.push(exclusiveData);
    }
    return exclusiveList;
}

function goodsList() {
    let goodsData = [];
    for(let i = 0;i < 2;i++){
        let goodsListData = {
            img: Random.dataImage('74x74'),
            num1: Random.natural(100,500),
            num2: Random.natural(300,600)
        };
        goodsData.push(goodsListData);
    }
    return goodsData;
}

function productsList() {
    let productsData = [];
    for(let i = 0;i < 4;i++){
        let productsListData = {
            img: Random.dataImage('168x168'),
            text: Random.cword(15),
            num: Random.natural(1,20000),
            city: Random.city()
        };
        productsData.push(productsListData);
    }
    return productsData;
}



const picData = Mock.mock('/getcarousePicList',getcarousePicList)
const optData1 = Mock.mock('/getOptData1',getOptData1);
const optData2 = Mock.mock('/getOptData2',getOptData2)
const commentData = Mock.mock('/getCommentData',getCommentData)
const bannerPicList = Mock.mock('/bannerList',bannerList);
const topPicList = Mock.mock('/topList',topList);
const exclusiveListData = Mock.mock('/exclusiveTitle',exclusiveTitle);
const goodsListBox = Mock.mock('/goodsList',goodsList);
const productsListBox = Mock.mock('/productsList',productsList);
export default {picData,optData1,optData2,commentData,bannerPicList,topPicList,exclusiveListData,goodsListBox,productsListBox} //此处return的是一个对象
